@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  color-scheme: light;
  --doc-bg: #f3f5ff;
  --doc-surface: #ffffff;
  --doc-surface-subtle: rgba(255, 255, 255, 0.75);
  --doc-border: rgba(15, 23, 42, 0.08);
  --doc-border-strong: rgba(15, 23, 42, 0.15);
  --doc-text-primary: #101828;
  --doc-text-secondary: #4b5563;
  --doc-text-tertiary: #6b7280;
  --doc-shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.14);
  --doc-shadow-md: 0 12px 32px rgba(15, 23, 42, 0.12);
  --brand-primary: #4f46e5;
  --brand-primary-active: #4338ca;
  --brand-primary-soft: rgba(79, 70, 229, 0.16);
  --brand-gradient: linear-gradient(135deg, #545dff 0%, #8168ff 50%, #b064ff 100%);
  --control-bg: rgba(255, 255, 255, 0.65);
  --control-bg-hover: rgba(255, 255, 255, 0.85);
}

[data-theme='dark'] {
  color-scheme: dark;
  --doc-bg: #0f172a;
  --doc-surface: #111c34;
  --doc-surface-subtle: rgba(17, 28, 52, 0.85);
  --doc-border: rgba(148, 163, 184, 0.1);
  --doc-border-strong: rgba(148, 163, 184, 0.18);
  --doc-text-primary: #f8fafc;
  --doc-text-secondary: #cbd5f5;
  --doc-text-tertiary: #94a3b8;
  --doc-shadow-lg: 0 30px 60px rgba(15, 23, 42, 0.55);
  --doc-shadow-md: 0 18px 32px rgba(15, 23, 42, 0.45);
  --brand-primary: #8b8fff;
  --brand-primary-active: #676bff;
  --brand-primary-soft: rgba(132, 148, 255, 0.18);
  --brand-gradient: linear-gradient(135deg, #646cff 0%, #8a7bff 50%, #c084fc 100%);
  --control-bg: rgba(17, 28, 52, 0.65);
  --control-bg-hover: rgba(17, 28, 52, 0.85);
}

@layer base {
  * {
    font-family: 'Inter', 'SF Pro Display', 'PingFang SC', 'Helvetica Neue', sans-serif;
  }
}

#root,
body,
html {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background-color: var(--doc-bg);
  color: var(--doc-text-primary);
}

pre[class*=language-] {
  background: var(--control-bg);
  border-radius: 16px;
}

.hljs-keyword {
  color: #07a;
}

.hljs-title {
  color: #58727e;
}

.hljs-string {
  color: #9a6e3a;
}

.hljs-title.function_ {
  color: #dd4a68;
}

.hljs-tag {
  color: #905;
}

.hljs-tag .hljs-attr {
  color: #690;
}

.hljs-tag .hljs-string {
  color: #07a;
}

.language-jsx {
  word-wrap: break-word;
  -webkit-font-smoothing: auto;
  background-color: #fafafa;
  border-radius: 16px;
  color: #999;
  display: block;
  font-family: Source Code Pro, Monaco, Inconsolata, monospace;
  font-size: 14px;
  font-weight: 400;
  line-height: 26px;
  overflow-x: auto;
  padding: 16px;
  position: relative;
  white-space: pre-wrap;
}

.demo-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: flex-start;
}

@media (max-width: 1024px) {
  .demo-container {
    align-items: center;
  }
}

.doc-container {
  display: flex;
  gap: 20px;
  width: 100%;
  align-items: flex-start;
}

.doc-container .code-container {
  flex: 1;
  min-width: 0;
}

.doc-container .demo-container {
  flex: none;
}

@media (max-width: 1100px) {
  .doc-container {
    flex-direction: column;
  }

  .doc-container .demo-container {
    width: 100%;
    align-items: center;
  }
}

.doc-header-blur {
  backdrop-filter: saturate(180%) blur(18px);
}

.doc-hero {
  background: linear-gradient(160deg, rgba(79, 70, 229, 0.16) 0%, rgba(99, 102, 241, 0.08) 60%, rgba(129, 140, 248, 0) 100%);
  border-radius: 36px;
  border: 1px solid var(--doc-border);
  box-shadow: var(--doc-shadow-lg);
  position: relative;
  overflow: hidden;
}

.doc-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.28), transparent 56%);
  pointer-events: none;
}

.doc-search-input::-webkit-input-placeholder {
  color: var(--doc-text-tertiary);
}

.doc-search-input:-ms-input-placeholder {
  color: var(--doc-text-tertiary);
}

.doc-search-input::placeholder {
  color: var(--doc-text-tertiary);
}

.demo-code {
  background: #0f172a;
  color: #e2e8f0;
  font-family: 'Fira Code', Monaco, Consolas, monospace;
  font-size: 12.5px;
  line-height: 20px;
  padding: 16px;
  overflow-x: auto;
}

.demo-empty {
  text-align: center;
  color: #6b7280;
  font-size: 14px;
  padding: 32px;
  border: 1px dashed #d1d5db;
  border-radius: 16px;
}

.demo-device {
  background-color: #fff;
  background-repeat: no-repeat;
  background-size: cover;
  border-radius: 44px;
  height: 620px;
  overflow: hidden;
  position: relative;
  width: 324px;
  z-index: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.demo-device__notch {
  display: flex;
  justify-content: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.demo-device__notch span {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.32);
}

.demo-device__notch span:first-child,
.demo-device__notch span:last-child {
  width: 9px;
  height: 9px;
  align-self: center;
}

.demo-device__title {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  position: relative;
  z-index: 1;
}

.demo-device__content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  z-index: 1;
}

.demo-device__block {
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.demo-device__block-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.demo-device__block-desc {
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #64748b;
}

.demo-device__block-body {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: linear-gradient(180deg, rgba(79, 70, 229, 0.05) 0%, rgba(79, 70, 229, 0.015) 100%);
  padding: 16px;
}

.demo-device__block-code {
  margin-top: 10px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.demo-device__block-code>summary {
  cursor: pointer;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #4338ca;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.demo-device__block-code[open]>summary {
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.demo-device__block-code>summary::-webkit-details-marker {
  display: none;
}

.demo-device__block-code>summary::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  margin-left: 12px;
}

.demo-device__block-code[open]>summary::after {
  transform: rotate(-135deg);
}

.demo-device__toolbar {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: auto;
  position: relative;
  z-index: 1;
}

.demo-device__toolbar span {
  width: 34px;
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.26);
}

.demo-device__toolbar span:nth-child(2) {
  width: 46px;
  background: rgba(79, 70, 229, 0.28);
}

.demo-code {
  border-top: none;
  background: #0f172a;
  color: #e2e8f0;
  font-family: 'Fira Code', Monaco, Consolas, monospace;
  font-size: 12.5px;
  line-height: 20px;
  padding: 16px;
  overflow-x: auto;
}

[data-theme='dark'] .demo-device {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.92) 0%, rgba(15, 23, 42, 0.82) 100%);
  border-color: rgba(91, 94, 255, 0.22);
  box-shadow: 0 32px 60px rgba(15, 23, 42, 0.55);
}

[data-theme='dark'] .demo-device::before {
  border-color: rgba(91, 94, 255, 0.16);
}

[data-theme='dark'] .demo-device__title {
  color: #e2e8f0;
}

[data-theme='dark'] .demo-device__block {
  background: rgba(17, 24, 39, 0.9);
  border-color: rgba(91, 94, 255, 0.2);
}

[data-theme='dark'] .demo-device__block-header h4 {
  color: #f8fafc;
}

[data-theme='dark'] .demo-device__block-desc {
  color: rgba(203, 213, 225, 0.82);
}

[data-theme='dark'] .demo-device__block-body {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(91, 94, 255, 0.35);
}

[data-theme='dark'] .demo-device__block-code {
  background: rgba(15, 23, 42, 0.5);
  border-color: rgba(91, 94, 255, 0.25);
}

[data-theme='dark'] .demo-device__block-code>summary {
  color: #8b8fff;
}

[data-theme='dark'] .demo-device__toolbar span {
  background: rgba(148, 163, 184, 0.32);
}

[data-theme='dark'] .demo-device__toolbar span:nth-child(2) {
  background: rgba(132, 148, 255, 0.42);
}

.md-mobile .demo-container .md-block-section .md-code-block>h2 {
  color: rgba(69, 90, 100, 0.6);
  font-size: 14px;
  font-weight: 400;
  line-height: 16px;
  margin: 0;
  padding: 8px 0 12px;
}

.md-pc {
  background-color: #fafafa;
  padding: 20px;
}

.md-pc .md-section>h1 {
  margin: 55px 0 20px;
  font-weight: 400;
  font-size: 22px;
  color: #1f2f3d;
}

.md-pc .md-block {
  border: 1px solid #eaeefb;
  border-radius: 4px;
  margin-bottom: 24px;
}

.md-pc .md-block .md-block-title {
  padding: 0 24px;
}

.md-pc .md-block .md-block-title>h3 {
  font-weight: 400;
  color: #1f2d3d;
}

.md-pc .md-block .md-block-title>p {
  font-size: 14px;
  color: #1f2d3d;
}

.md-pc .md-block .md-html-block {
  overflow: hidden;
  transition: all 0.3s;
}

.md-pc .md-block .md-block-content {
  padding: 24px;
}

.md-pc .card.show .code-block {
  max-height: 100vh;
  overflow-y: auto;
  opacity: 1;
}

.md-pc .card.show .control-block span {
  transform: rotate(180deg);
}

.md-pc .card.hide .code-block {
  max-height: 0px;
  overflow-y: auto;
  opacity: 0;
}

.md-pc .control-block {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 36px;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  background-color: #fff;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  text-align: center;
  color: #d3dce6;
  cursor: pointer;
  -webkit-transition: 0.2s;
  transition: 0.2s;
  position: relative;
}

.md-pc .control-block>span {
  display: block;
  width: 44px;
  height: 36px;
  background: url("") center center no-repeat;
  background-size: 20px auto;
  transition: all 0.3s;
  opacity: 0.7;
}

.card {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 12px #ebedf0;
  margin-bottom: 24px;
  padding: 24px;
}

.md-api .card>table {
  border-collapse: collapse;
  color: #34495e;
  font-size: 14px;
  line-height: 1.5;
  margin-top: 12px;
  width: 100%;
}

.md-api .card>table th {
  font-weight: 600;
  padding: 8px 10px;
  text-align: left;
}

.md-api .card>table th:first-child {
  padding-left: 0;
}

.md-api .card>table td {
  border-top: 1px solid #f1f4f8;
  padding: 8px;
}

.md-api .card>table td:first-child {
  padding-left: 0;
}

.md-api .card>table code {
  -webkit-font-smoothing: antialiased;
  background-color: #f7f8fa;
  border-radius: 4px;
  display: inline;
  font-family: inherit;
  font-size: 14px;
  margin: 0 2px;
  padding: 2px 5px;
  word-break: keep-all;
}

.md-api .card>table em {
  -webkit-font-smoothing: auto;
  color: #4fc08d;
  font-family: Source Code Pro, Monaco, Inconsolata, monospace;
  font-size: 14px;
  font-style: normal;
}

.doc-container {
  display: flex;
}

.doc-simulator__bar {
  fill: rgba(125, 125, 125, .3);
  display: block;
  padding: .5rem 1.2rem;
  top: 12px;
  width: 100%;
  z-index: 2;
}